/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_listeposte")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvListeposte.findAll", query = "SELECT c FROM CvListeposte c"),
    @NamedQuery(name = "CvListeposte.findByIdposte", query = "SELECT c FROM CvListeposte c WHERE c.idposte = :idposte"),
    @NamedQuery(name = "CvListeposte.findByActive", query = "SELECT c FROM CvListeposte c WHERE c.active = :active"),
    @NamedQuery(name = "CvListeposte.findByPoste", query = "SELECT c FROM CvListeposte c WHERE c.poste = :poste")})
public class CvListeposte implements Serializable {
    @Column(name = "active")
    private boolean active;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idposte")
    private String idposte;
    @Basic(optional = false)
    @Column(name = "poste")
    private String poste;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvListeposteIdposte", fetch = FetchType.EAGER)
    private List<CvPosteoccupe> cvPosteoccupeList;

    public CvListeposte() {
    }

    public CvListeposte(String idposte) {
        this.idposte = idposte;
    }

    public CvListeposte(String idposte, String poste) {
        this.idposte = idposte;
        this.poste = poste;
    }

    public String getIdposte() {
        return idposte;
    }

    public void setIdposte(String idposte) {
        this.idposte = idposte;
    }

    public String getPoste() {
        return poste;
    }

    public void setPoste(String poste) {
        this.poste = poste;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvPosteoccupe> getCvPosteoccupeList() {
        return cvPosteoccupeList;
    }

    public void setCvPosteoccupeList(List<CvPosteoccupe> cvPosteoccupeList) {
        this.cvPosteoccupeList = cvPosteoccupeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idposte != null ? idposte.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvListeposte)) {
            return false;
        }
        CvListeposte other = (CvListeposte) object;
        if ((this.idposte == null && other.idposte != null) || (this.idposte != null && !this.idposte.equals(other.idposte))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvListeposte[ idposte=" + idposte + " ]";
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }
    
}
